function [angles,projs,l,det_space] = calcproj(num_angles,det_length,num_dets)

% Calculates projections with parallel beams -- Object assumed to be in a
% square box with corners (0,0), (0,1), (1,1) and (1,0)
%
% [angles,projs,l,det_space] = calcproj(num_angles,det_length,num_dets)
%
% Inputs: 
% num_angles = Number of projections over 180 degrees
% det_length = Length of the detector
% num_dets = Number of detectors over "det_length"
%
% Outputs:
% angles = angles at which projections are obtained
% ith row of projs = projection at detectors for angles(i)
% l = detetctor positions in [-L/2,L/2]
% det_space = detector spacing along the projection
%
% Developed by	Srikrishna Bhashyam and Andy Doran
%               Rice University
% 		March 1, 1999
%

r = 1;
cx = 0.5;
cy = 0.5;

angles = [0:pi/num_angles:pi - pi/num_angles];
det_space = det_length/num_dets;
l = [-det_length/2 + det_space/2:det_space:det_length/2 - det_space/2];

for i_ang = 1:num_angles
x1 = cx + r*cos(angles(i_ang)) - l*sin(angles(i_ang));
y1 = cy + r*sin(angles(i_ang)) + l*cos(angles(i_ang));
x2 = cx - r*cos(angles(i_ang)) - l*sin(angles(i_ang));
y2 = cy - r*sin(angles(i_ang)) + l*cos(angles(i_ang));

x1 = round(x1*100000)/100000;
y1 = round(y1*100000)/100000;
x2 = round(x2*100000)/100000;
y2 = round(y2*100000)/100000;
 
for i_det = 1:num_dets
projs(i_ang,i_det) = project(x1(i_det),y1(i_det),x2(i_det),y2(i_det),0,0,0); 
end

end




